From: Jasper St. Pierre Date: Thu, 29 Nov 2012 00:56:02 +0000 (-0500) Subject: scroll-view-fade: Only calculate the ratios if they're needed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5348 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=69347fff09964fc0dea591da83c5a627b6757f0a;p=gnome-shell.git scroll-view-fade: Only calculate the ratios if they're needed This prevents some calculations being done for poor drivers with bad optimizers. https://bugzilla.gnome.org/show_bug.cgi?id=689249 --- diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl index 7897c7b80..01e05f827 100644 --- a/src/st/st-scroll-view-fade.glsl +++ b/src/st/st-scroll-view-fade.glsl @@ -52,29 +52,25 @@ void main () float ratio = 1.0; float fade_bottom_start = fade_area[1][1] - vfade_offset; float fade_right_start = fade_area[1][0] - hfade_offset; - float ratio_top = y / vfade_offset; - float ratio_bottom = (fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start); - float ratio_left = x / hfade_offset; - float ratio_right = (fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start); bool fade_top = y < vfade_offset && vvalue > 0; bool fade_bottom = y > fade_bottom_start && vvalue < 1; bool fade_left = x < hfade_offset && hvalue > 0; bool fade_right = x > fade_right_start && hvalue < 1; if (fade_top) { - ratio *= ratio_top; + ratio *= (y / vfade_offset); } if (fade_bottom) { - ratio *= ratio_bottom; + ratio *= (fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start); } if (fade_left) { - ratio *= ratio_left; + ratio *= (x / hfade_offset); } if (fade_right) { - ratio *= ratio_right; + ratio *= (fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start); } cogl_color_out *= ratio;